<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <title>子传父</title>
</head>
<body>

<div id="app">
  <ul>
    <li v-for="item in fruits">{{item}}</li>
  </ul>
  <hr>
  <menu-item :fruit-list="fruits"></menu-item>
</div>

<script src="../lib/vue.js"></script>
<script>
  Vue.component('menu-item', {
    props: ['fruitList'],
    template: `
      <div>
        <ul>
          <li v-for="item in fruitList">{{item}}</li>
        </ul>
        <button @click="fruitList.push('lemon')">点击</button>
      </div>
    `
  })

  let vm = new Vue({
    el: '#app',
    data: {
      fruits: ['apple', 'orange', 'banana']
    }
  })
</script>

</body>
</html>